﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Beeldbankmvc.Models
{
    public class ProjectRepository
    {
        BeeldbankLinqDataContext db = new BeeldbankLinqDataContext();

        public IQueryable<BEELDBANK_MEDIAOBJECT_FACETS_PROJECT> FindAll()
        {
            return db.BEELDBANK_MEDIAOBJECT_FACETS_PROJECTs;
        }

        public String FindProjectName(int id)
        {
            return db.BEELDBANK_MEDIAOBJECT_FACETS_PROJECTs.SingleOrDefault(m => m.Id == id).Project;
        }

        public BEELDBANK_MEDIAOBJECT_FACETS_PROJECT FindOne(int id)
        {
            return db.BEELDBANK_MEDIAOBJECT_FACETS_PROJECTs.SingleOrDefault(m => m.Id == id);
        }

        public void Add(BEELDBANK_MEDIAOBJECT_FACETS_PROJECT project)
        {
            db.BEELDBANK_MEDIAOBJECT_FACETS_PROJECTs.InsertOnSubmit(project);
        }

        public void Delete(BEELDBANK_MEDIAOBJECT_FACETS_PROJECT project)
        {
            db.BEELDBANK_MEDIAOBJECT_FACETS_PROJECTs.DeleteOnSubmit(project);
        }

        public void Save()
        {
            db.SubmitChanges();
        }
    }
}